@extends('admin.layout.index')
@section('js')
<script src="/web/js/libs/jquery-1.8.3.min.js"></script>
<script>
//ajax验证是否选择了商品
$(function (){
    $('[name=gid]').blur(function (){
        val = $(this).val();
        //alert(val);
        $.get('/admin/goods/inventoryverify','gid='+val, function (msg){
            if(msg != 1){
                $('#span1').empty().append('<font style="color:red">请选择商品</font>')
            }else{
                $('#span1').empty().append('<font style="color:green">已选择商品</font>')
            }
        },'html')
    })
    $('[name=size]').blur(function (){
        val = $(this).val();
        if(val == 0){
             $('#span2').empty().append('<font style="color:red">请选择尺寸</font>')
        }else{
             $('#span2').empty().append('<font style="color:green">已选择尺寸</font>')
        }
    })
    $('[name=color]').blur(function (){
        val = $(this).val();
        if(val == 0){
            $('#span3').eq(1).empty().append('<font style="color:red">请选择颜色</font>')
        }else{
            $('#span3').eq(1).empty().append('<font style="color:green">已选择颜色</font>')
        }
    })
})
</script>
@endsection
@section('content')
@if (count($errors) > 0)
    <div class="mws-form-message error">
        <ul>
            @foreach ($errors->all() as $error)
                <li>{{ $error }}</li>
            @endforeach
        </ul>
    </div>
@endif
<div class="mws-panel grid_8">
	<div class="mws-panel-header">
    	<span>商品库存添加</span>
    </div>
    <div class="mws-panel-body no-padding">
    	<form action="/admin/goods/inventoryinsert" class="mws-form" method='post'>
    		{{csrf_field()}}
    		<div class="mws-form-inline">
    			<div class="mws-form-row">
    				<label class="mws-form-label">选择商品货号</label>
    				<div class="mws-form-item">
    					<select class="large" name="gid" style="width:200px">
    					<option value=''>--请选择--</option>
    					@foreach($data as $k => $v)
    						<option value="{{$v['id']}}">{{$v['articlenum']}}</option>
    					@endforeach
    					</select>
                        <span id="span1"></span>
    				</div>
    			</div>
                <div class="mws-form-row">
                    <label class="mws-form-label">尺寸</label>
                    <div class="mws-form-item">
                        <select class="large" name="size" style="width:200px">
<<<<<<< HEAD
                            <option value=''>--请选择--</option>
                            @foreach($data1 as $v)
                            <option value="{{$v['id']}}">--{{$v['sizename']}}--</option>
                            @endforeach
=======
                            <option value='0'>--请选择--</option>
                            <option value='XS'>--XS--</option>
                            <option value='S'>--S--</option>
                            <option value='M'>--M--</option>
                            <option value='L'>--L--</option>
                            <option value='XL'>--XL--</option>
                            <option value='2XL'>--2XL--</option>
                            <option value='3XL'>--3XL--</option>
>>>>>>> 31e42f2d3415b82d4888522298db4e7de5f9c8aa
                        </select>
                        <span id="span2"></span>
                    </div>
                </div>         
                <div class="mws-form-row">
                    <label class="mws-form-label">颜色</label>
                    <div class="mws-form-item">
                        <select class="large" name="color" style="width:200px">
<<<<<<< HEAD
                            <option value=''>--请选择--</option>
                            @foreach($data2 as $v)
                            <option value="{{$v['id']}}">--{{$v['colorname']}}--</option>
                            @endforeach
=======
                            <option value='0'>--请选择--</option>
                            <option value='红'>--红--</option>
                            <option value='白'>--白--</option>
                            <option value='黄'>--黄--</option>
                            <option value='黑'>--黑--</option>
                            <option value='灰'>--灰--</option>
>>>>>>> 31e42f2d3415b82d4888522298db4e7de5f9c8aa
                        </select>
                        <span id="span3"></span>
                    </div>
                </div>
                <div class="mws-form-row">
                    <label class="mws-form-label">库存数量</label>
                    <div class="mws-form-item">
                        <input type="text" class="small" name="num" style="width:200px">
                    </div>
                </div>
    		</div>
    		<div class="mws-button-row">
    			<input type="submit" class="btn btn-danger" value="添加">
    			<input type="reset" class="btn " value="重置">
    		</div>
    	</form>
    </div>    	
</div>
@endsection
